package com.tencent.sr.iris.basic.saas.service.model.advisor;

import com.alibaba.excel.annotation.ExcelProperty;
import com.alibaba.excel.annotation.write.style.ColumnWidth;
import com.tencent.sr.iris.activity.interfaces.response.group.AdvisorBoardResponse;
import com.tencent.sr.iris.basic.saas.common.enums.IrisTaskStatusEnum;
import com.tencent.sr.iris.basic.saas.common.enums.IrisTaskTypeEnum;
import io.swagger.annotations.ApiModel;
import lombok.Data;
import lombok.extern.slf4j.Slf4j;

@Data
@ApiModel(value = "导师身份-团长任务列表导出信息")
@Slf4j
@ColumnWidth(15)
public class AdvisorBoardExportInfo {

    @ExcelProperty(value = "序号", index = 0)
    private int num;

    /**
     * 1=邀新有礼，3=GMV冲刺赛，4=销量冲刺赛
     */
    @ExcelProperty(value = "任务类型", index = 1)
    private String taskTargetEvaluation;

    @ExcelProperty(value = "任务的开始时间", index = 2)
    private String taskPhaseStartTime;

    @ExcelProperty(value = "任务结束时间", index = 3)
    private String taskPhaseEndTime;

    @ExcelProperty(value = "任务名称", index = 4)
    private String taskPhaseName;

    /**
     * 1=准备中, 2=待上线，3=已上线，4=已下线，5=已作废
     */
    @ExcelProperty(value = "任务状态", index = 5)
    private String taskPhaseStatus;

    @ExcelProperty(value = "可报名学员数", index = 6)
    private Integer canJoinTaskCount;

    @ExcelProperty(value = "报名学员数", index = 7)
    private Integer taskPhaseLeaderLimit;

    @ExcelProperty(value = "报名率(%)", index = 8)
    private Double joinTaskRate;

    @ExcelProperty(value = "获奖学员数", index = 9)
    private Integer countPredictAwardUserNum;

    public void readFromSearchResponseData(AdvisorBoardResponse response) {
        this.setTaskTargetEvaluation(IrisTaskTypeEnum.getByType(response.getTaskTargetEvaluation()));
        this.setTaskPhaseStartTime(response.getTaskPhaseStartTime());
        this.setTaskPhaseEndTime(response.getTaskPhaseEndTime());
        this.setTaskPhaseName(response.getTaskPhaseName());
        this.setTaskPhaseStatus(IrisTaskStatusEnum.getByStatus(response.getTaskPhaseStatus()));
        this.setTaskPhaseLeaderLimit(response.getTaskPhaseLeaderJoinCount());
        this.setCanJoinTaskCount(response.getCanJoinTaskCount());
        this.setJoinTaskRate(response.getJoinTaskRate());
        this.setCountPredictAwardUserNum(response.getCountPredictAwardUserNum());
    }

}
